Why OOP? & Introduction to Java
A very important subject — Object-Oriented Programming with Java
How many of you enjoyed programming in C?
How many felt programs became confusing after 300-400 lines?
From C Programming to OOP
Can we build a banking system, hospital system, or university management system using only functions and global data?
When Complexity Strikes
Imagine managing:
Student data is used in how many functions?
What happens if the student structure changes?
What happens with multiple programmers?
Managing Complexity
OOP was not created to replace C.
It was created to manage complexity.
Has properties: name, age, roll number
Can perform actions: study, attend exam
Has properties: name, subject, experience
Can perform actions: teach, grade papers
Has properties: title, credits, duration
Can perform actions: enroll students, generate results
A Programming Paradigm
| Real World | OOP Concept |
|---|---|
| Student | Class |
| Name, age, roll number | Data members |
| Study(), attendExam() | Methods |
In OOP, data and behavior live together.
This is the biggest shift from C.
The Fundamental Shift
The Foundation of Object-Oriented Design
Today, understand ideas, not definitions.
What it means: Wrapping data and methods together, protecting data from misuse
Example: Bank account - you cannot directly change balance, must use deposit() or withdraw()
What it means: Showing what an object does, hiding how it does it
Example: ATM machine - you press buttons, don't see internal logic
What it means: Reusing existing code, creating new classes from old ones
Example: Person → Student → BTechStudent
What it means: One interface, multiple behaviors
Example: draw() for circle vs draw() for rectangle - same call, different result
From Concept to Implementation
OOP is a concept.
Java is a tool to implement that concept.
Java was originally called "Oak" and was developed for interactive television!
Write Once, Run Anywhere
Java code runs on Windows, Linux, macOS, and more!
Your Java code → Bytecode → JVM → Machine Code
Putting Theory into Practice
Student? → Classname and age? → Datadisplay()? → BehaviorOne class → many objects
Like one blueprint → many buildings
What We'll Cover This Semester
This is not a memorization subject.
This is a thinking subject.
Focus on understanding concepts, not just syntax!
What I Expect From You
What excites you most about OOP?
The Mindset Shift
"Good programmers write code.
Great programmers design systems."
We'll continue in the next lecture with Classes and Objects in detail.